import sys
import os
from PyQt5.QtWidgets import QApplication, QFileSystemModel
from PyQt5.QtCore import *
from PyQt5.QtQml import QQmlListProperty, QQmlApplicationEngine

PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'gp_jobs', 'gp_examples', 'FR')


class Catalog(QFileSystemModel):
    pass


def main():

    app = QApplication(sys.argv)
    engine = QQmlApplicationEngine()

    modelCatalog = Catalog()
    modelCatalog.setRootPath(PATH)

    print(modelCatalog.rootPath())
    engine.rootContext().setContextProperty("modelCatalog",  modelCatalog)
    engine.rootContext().setContextProperty("rootPathIndex", modelCatalog.index(modelCatalog.rootPath()))

    engine.load("main.qml")
    view = engine.rootObjects()[0]
    return app.exec()

if __name__ == "__main__":
    main()
